package com.asia.dao.ods;

import java.util.List;

import com.asia.domain.ods.OdsFieldTable;
import com.asia.domain.ods.OdsTable;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;
import com.util.HibernateUtil;

public class CsvDataIODao
{
    private List<OdsTable> list1;
    private List<OdsFieldTable> list2;

    public boolean SaveOdsTable(OdsTable odsTable)
    {
        Session session=null;
        Query query = null;
        session = (Session)HibernateUtil.getSessionFactory().getCurrentSession();
        String hql = null;
        Transaction tx= session.beginTransaction();
        try {
            session.save(odsTable);
            session.flush();
            session.clear();
        } catch (Exception e) {
            // TODO: handle exception
            session.flush();
            session.clear();
            return false;
        }
        tx.commit();
        return true;
    }

    public boolean SaveOdsFieldTable(OdsFieldTable odsFieldTable)
    {
        Session session=null;
        Query query = null;
        session = (Session)HibernateUtil.getSessionFactory().getCurrentSession();
        String hql = null;
        Transaction tx= session.beginTransaction();
        try {
            session.save(odsFieldTable);
            session.flush();
            session.clear();
        } catch (Exception e) {
            // TODO: handle exception
            session.flush();
            session.clear();
            return false;
        }
        tx.commit();
        return true;
    }
}